package com.glodon.paas.account.web.util;

import org.springframework.security.authentication.encoding.PasswordEncoder;

import com.glodon.paas.account.service.util.AccountPasswordEncoder;
/**
 * 密码加密实现类由server提供
 * 
 * @author a
 *
 */
public class PasswordEncoderProxy  implements PasswordEncoder {
	@Override
	public String encodePassword(String rawPass, Object salt) {
		if(salt==null){
			return AccountPasswordEncoder.encodePassword(rawPass, null);
		}
		return AccountPasswordEncoder.encodePassword(rawPass, salt.toString());
		
	}

	@Override
	public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
		if(salt==null){
			return AccountPasswordEncoder.isPasswordValid(encPass, rawPass, null);
		}
		return AccountPasswordEncoder.isPasswordValid(encPass, rawPass, salt.toString());
	}
}
